package com.ruoyi.common.core.context;

import com.kfyty.loveqq.framework.web.mvc.servlet.request.support.RequestContextHolder;
import com.ruoyi.common.core.text.Convert;

/**
 * 权限信息
 *
 * @author ruoyi
 */
public class PermissionContextHolder
{
    private static final String PERMISSION_CONTEXT_ATTRIBUTES = "PERMISSION_CONTEXT";

    public static void setContext(String permission)
    {
        RequestContextHolder.getRequest().setAttribute(PERMISSION_CONTEXT_ATTRIBUTES, permission);
    }

    public static String getContext()
    {
        return Convert.toStr(RequestContextHolder.getRequest().getAttribute(PERMISSION_CONTEXT_ATTRIBUTES));
    }
}
